//pointer to Data Members

#include <iostream>
#include <cstdio>
using namespace std;
class Point3d {
public:
  virtual void vf(){};
  static Point3d origin;
  double x, y, z;
  double getX() {return x;}
};

int main()
{
  double Point3d::*px = &Point3d::x;
  double Point3d::*py = &Point3d::y;
  double Point3d::*pz = &Point3d::z;

  Point3d a;
  a.x = 12.12;
  cout<<a.*px<<"\t"<<a.*py<<"\t"<<a.*pz<<endl;

  double *pax = &a.x;
  double *pay = &a.y;
  double *paz = &a.z;
  cout<<pax<<"\t"<<pay<<"\t"<<paz<<endl;

  double (Point3d::*ptr_mf)() = &Point3d::getX;
  printf("ptr_mf:%p\n",(void*)ptr_mf);
  printf("(a.*ptr_mf)():%g\n",(a.*ptr_mf)());

  return 0;
}
